<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateO2oUserShopTable1554107641 extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        $prefix = config('ibrand.app.database.prefix', 'ibrand_');
		if(!Schema::hasTable($prefix . 'o2o_user_shop')){
			Schema::create($prefix . 'o2o_user_shop', function (Blueprint $table) {

				$table->increments('id');

				$table->integer('user_id')->nullable();   //用户ID

				$table->integer('clerk_id')->nullable();

				$table->string('open_id')->nullable();

				$table->string('tags')->nullable();

				$table->integer('shop_id')->nullable();   //所管理门店ID

				$table->timestamps();

				$table->softDeletes();

			});
		}
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        $prefix = config('ibrand.app.database.prefix', 'ibrand_');
        Schema::drop($prefix . 'o2o_user_shop');
    }
}
